// 用户信息
import { userAccountLogin } from '@/api/user.js'
export default {
  // 开启命名空间
  namespaced: true,
  state() {
    return {
      profile: {
        uname: '果冻'
      }
    }
  },
  mutations: {
    setUser(state, payload) {
      state.profile = payload
    },
    removeUsser(state) {
      state.profile = {}
    }
  },
  actions: {
    async getUser(ctx, payload) {
      // 发请求，获取登录数据
      const res = await userAccountLogin(payload)
      ctx.commit('setUser', res.result)
      console.log('----', res)
    }
  }
}
